import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MaterialCharaRecordVO, MaterialCharaRecordForm, MaterialCharaRecordQuery } from '@/api/manu/materialCharaRecord/types';

/**
 * 查询物料特征值列表
 * @param query
 * @returns {*}
 */

export const listMaterialCharaRecord = (query?: MaterialCharaRecordQuery): AxiosPromise<MaterialCharaRecordVO[]> => {
  return request({
    url: '/manu/materialCharaRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物料特征值详细
 * @param id
 */
export const getMaterialCharaRecord = (id: string | number): AxiosPromise<MaterialCharaRecordVO> => {
  return request({
    url: '/manu/materialCharaRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增物料特征值
 * @param data
 */
export const addMaterialCharaRecord = (data: MaterialCharaRecordForm) => {
  return request({
    url: '/manu/materialCharaRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改物料特征值
 * @param data
 */
export const updateMaterialCharaRecord = (data: MaterialCharaRecordForm) => {
  return request({
    url: '/manu/materialCharaRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除物料特征值
 * @param id
 */
export const delMaterialCharaRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/manu/materialCharaRecord/' + id,
    method: 'delete'
  });
};
